<?php

defined('_JEXEC') or die;
$location = JRequest::getVar("location");
	$location_alias = JRequest::getVar("location_alias");
	$option = JRequest::getVar("option");
	if($option == "com_bakerys")
		$catid = JRequest::getVar("catid");

foreach ($categories as $item) :

?>
	<li class="<?php echo ($catid == $item->id)?"current active":"" ?>"> 
		<?php $levelup = $item->level - $startLevel - 1; ?>
		<a href="<?php echo JRoute::_("index.php?option=com_bakerys&view=bakerys&location=$location:$location_alias&catid=".$item->id.":".$item->alias) ?>">
		<?php echo $item->title;?>
		</a>

		<?php
		if (count($item->getChildren()))
		{

			echo '<ul style="margin-left:15px" class="menu_child">';
			$temp = $categories;
			$categories = $item->getChildren();
			require JModuleHelper::getLayoutPath('mod_bakery_categories', $params->get('layout', 'default').'_items');
			$categories = $temp;
			echo '</ul>';
		}
		?>
 </li>
<?php endforeach; ?>
